﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Csla.Wpf;
using OpenExpressApp.Template;
using Itenso.Windows.Input;
using OpenExpressApp.Module;
using OpenExpressApp.Module.WPF;
using OpenExpressApp.Module.WPF.Templete;
using OpenExpressApp.Types;
using OpenExpressApp.MetaModel;
using OpenExpressApp.Command;

namespace OpenExpressApp.WPF.Templete
{
    /// <summary>
    /// Interaction logic for SelectForm.xaml
    /// </summary>
    public partial class ListForm : WindowTemplateBase
    {
        private ListFormController _controller;

        public ListForm(Type boType, params Object[] getListParam)
            : base(boType)
        {
            this.InitializeComponent();

            this._controller = new ListFormController(this, getListParam);

            if (this.HasQueryPanel() == false)
            {
                this.ListView.DataLoader.AsyncGetObject(getListParam);
            }
        }

        public override IFrameController Controller
        {
            get { return this._controller; }
        }

        public override ModuleType ModuleType
        {
            get
            {
                return ModuleType.List;
            }
        }

        public override object GetRegion(string regionName)
        {
            switch (regionName)
            {
                case ViewRegionNames.ListRegion:
                    return listRegion;
                case ViewRegionNames.ConditionQueryRegion:
                    return conditionQueryRegion;
                case ViewRegionNames.NavigateQueryRegion:
                    return navigateQueryRegion;
                case ViewRegionNames.MainToolBar:
                    return mainToolBar;
                default:
                    return null;
            }
        }

        public override void LayoutQueryPanel()
        {
            LayoutQueryPanel(this.ListView, queryPane, dcCondition, dcNavigate);
        }
    }
}
